package com.yt.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname controller
 * @Description
 * @Date 2021/10/25 12:18
 * @Create by 杨涛
 */
@RestController
@Slf4j
@EnableBinding(Sink.class)
public class ReceiveController {
    @Value("${server.port}")
    private String port;
    @StreamListener(Sink.INPUT)
    public void getMessage(Message<String> message){
        log.info("receive message:"+message.getPayload()+"  port:"+port);
    }
}
